|
|
|
|
|
|
|
The lpData parameter is an address of a buffer to load with data from the registry. The lpcbData parameter is a pointer to a Long variable that contains the size of the data buffer. If the buffer is not large enough to hold the registry data, the function returns error number 234 (ERROR_MORE_DATA) to indicate that a larger buffer is required and loads the lpcbData variable with the required buffer length. If the lpData parameter is NULL, the RegQueryValueEx function loads the lpcbData variable with the necessary buffer length (but does not report error 234). If the registry value is a string data type, the buffer length includes the NULL termination characters. |
|
|
|
|
|
|
|
|
The DisplayValue function uses the RegQueryValueEx API function to read and display the data. This version of the function only handles the string, long, and binary data types, because these are the types used most often. The function is shown here: |
|
|
|
|
|
|
|
|
Private Sub DisplayValue(ByVal hKey As Long, ByVal ValueName As String)
' Load the lblValue label control with the data.
' Can you handle string, long, and binary data types?
End Sub |
|
|
|
|
|
|
|
|
As you can see, the function works perfectly. |
|
|
|
 |
|
 |
|
|
TECH REVIEWER TO AUTHOR Dan, you forgot the VB declaration and code for this example. Please fill it in. |
|
|
|
 |
|
 |
|
|
PUBLISHER TO TECH REVIEWER Can't seem to reach Dan. I think he's partying at Disney World or something. Is there anything you can do? |
|
|
|
 |
|
 |
|
|
TECH REVIEWER TO PUBLISHER You're not paying me enough to rewrite the book. If Dan can't check his e-mail while he's on vacation, then you'll have to set the page as is. But it will look awfully careless of him. |
|
|
|
 |
|
 |
|
|
PUBLISHER TO TECH REVIEWER I have an idea. Tell the readers that they're supposed to create the declaration and write the code. We'll get Dan to write in some working code before we go to print. Nobody will realize that this was a major screw-up. |
|
|
|
 |
|
 |
|
|
TECH REVIEWER TO PUBLISHER This book is so strange alreadyI bet we'll get away with it. But be sure your Production Department deletes all annotations before we go to print. |
|
|
|
|
|